

package com.hazelcast.client.impl.spi;

import com.hazelcast.internal.nio.Connection;

/**
 * Base interface for all client {@link EventHandler}s.
 *
 * @param <E> event type
 */
public interface EventHandler<E> {

    void handle(E event);

    /**
     * This method is called before registration request is sent to node.
     * <p>
     * Note that this method will also be called while first registered node is dead
     * and re-registering to a second node.
     */
    default void beforeListenerRegister(Connection connection) {
    }

    /**
     * This method is called when registration request response is successfully returned from node.
     * <p>
     * Note that this method will also be called while first registered node is dead
     * and re-registering to a second node.
     */
    default void onListenerRegister(Connection connection) {
    }

}
